package sealte.util.database.util;

import java.util.HashMap;
import java.util.Map;

public class DBFieldType {
	
	private static Map<Integer,String> FieldTypeMap = null;
	
	static{
		FieldTypeMap = new HashMap<Integer,String>();
		FieldTypeMap.put(-7,"BIT");
		FieldTypeMap.put(-6, "TINYINT");
		FieldTypeMap.put(5, "SMALLINT");
		FieldTypeMap.put(4, "INTEGER");
		FieldTypeMap.put(-5, "BIGINT");
		FieldTypeMap.put(6, "FLOAT");
		FieldTypeMap.put(7, "REAL");
		FieldTypeMap.put(8, "DOUBLE");
		FieldTypeMap.put(2, "NUMERIC");
		FieldTypeMap.put(3, "DECIMAL");
		FieldTypeMap.put(1, "CHAR");
		FieldTypeMap.put(12, "VARCHAR");
		FieldTypeMap.put(-1, "LONGVARCHAR");
		FieldTypeMap.put(91, "DATE");
		FieldTypeMap.put(92, "TIME");
		FieldTypeMap.put(93, "TIMESTAMP");
		FieldTypeMap.put(-2, "BINARY");
		FieldTypeMap.put(-3, "VARBINARY");
		FieldTypeMap.put(-4, "LONGVARBINARY");
		FieldTypeMap.put(0, "NULL");
		FieldTypeMap.put(1111, "OTHER");
		FieldTypeMap.put(2000, "JAVA_OBJECT");
		FieldTypeMap.put(2001, "DISTINCT");
		FieldTypeMap.put(2002, "STRUCT");
		FieldTypeMap.put(2003, "ARRAY");
		FieldTypeMap.put(2004, "BLOB");
		FieldTypeMap.put(2005, "CLOB"); // v1.2
		FieldTypeMap.put(2006, "REF"); // v1.2
		FieldTypeMap.put(70, "DATALINK"); // v1.4
		FieldTypeMap.put(16, "BOOLEAN"); // v1.4
		//---------- JDBC 4.0 -------------------
		FieldTypeMap.put(-8, "ROWID"); // v1.6
		FieldTypeMap.put(-15, "NCHAR"); // v1.6
		FieldTypeMap.put(-9, "NVARCHAR"); // v1.6
		FieldTypeMap.put(-16, "LONGNVARCHAR"); // v1.6
		FieldTypeMap.put(2011, "NCLOB"); // v1.6
		FieldTypeMap.put(2009, "SQLXML"); // v1.6
	}
	
	public DBFieldType(){
		
	}
	
	public static String getFieldTypeStr(int typeNum){
		return FieldTypeMap.get(typeNum);
	}
}
